import React from 'react';
import {createForm, IFormProps} from '@formily/core';
import {createSchemaField, FormProvider, SchemaReactComponents} from '@formily/react';
import {
    Cascader,
    Checkbox,
    DatePicker,
    Input,
    NumberPicker,
    Password,
    Radio,
    Select, Switch,
    TimePicker,
    Transfer, Upload, FormItem, FormLayout,
    Editable, ArrayTable, SelectTable, FormGrid, Submit, FormButtonGroup
} from '@formily/antd';
import {TreeSelect} from 'antd';
import styles from '../index.less';
import {useMount} from "ahooks";
import {ExampleInterface} from "@/types/interface/example.interface";

const Example: React.FC<ExampleInterface> = (props) => {
    const basicForm = createForm<IFormProps>();
    const SchemaField = createSchemaField<SchemaReactComponents>({
        components: {
            FormItem, FormLayout, Input, Password, Select, TreeSelect, DatePicker,
            TimePicker, NumberPicker, Transfer, Cascader, Radio, Checkbox, Upload,
            Switch, Editable, ArrayTable, SelectTable, FormGrid, Submit, FormButtonGroup
        },
    });
    useMount(() => {
    })
    return (
        <div className={styles['basic-container']}>
            <FormProvider form={basicForm}>
                <SchemaField schema={props.basicFormSchema}>
                </SchemaField>
                <SchemaField schema={props.basicTableSchema}></SchemaField>
            </FormProvider>
        </div>
    );
};
export default Example;
